﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Model;
using System.Data.SqlClient;
namespace DAL
{
   public class DALRoomType
    {
        public static List<ModelRoomType> BaoXiangLX(){
            string sql="select * from RoomType";
            SqlDataReader JG = DBHelper.Zhilianshi(sql, null);

            List<ModelRoomType> LI = new List<ModelRoomType>();
            while (JG.Read())
            {
              ModelRoomType M = new ModelRoomType();
              M.RTID=int.Parse(JG["RTID"].ToString());
              M.RTName = JG["RTName"].ToString();
              M.RTConsume =double.Parse(JG["RTConsume"].ToString());
              M.RTIsDisCount = bool.Parse(JG["RTIsDisCount"].ToString());
              M.RTMount = int.Parse(JG["RTMount"].ToString());
              LI.Add(M);
            }
            JG.Close();
            return LI;
        }
       //查询桌子的最低消费
       public static object CX_zd_xf(string ID){
           string sql = @"select RTConsume from RoomType
where RTID=(select RTID from Tables where TableID=@TableID)";
           List<SqlParameter> list = new List<SqlParameter>{
                new SqlParameter("@TableID",ID)
           };
           return DBHelper.Chadanzhi(sql,list.ToArray());
       }
    }
}
